package com.yjd.bi.user.dao.impl;


import com.yjd.bi.user.dao.ILoginFrequencyDao;
import com.yjd.bi.user.model.LoginFrequencyModel;
import com.yjd.comm.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * <b>description</b>：登录频率数据访问层 <br>
 * <b>time</b>：2016-04-26 11:18:27 <br>
 * <b>author</b>： zhoujin
 */
@Component("loginFrequencyDao")
public class LoginFrequencyDaoImpl extends BaseDaoImpl implements ILoginFrequencyDao {

	private static final String SQLMAPNAMESPACE = LoginFrequencyModel.class.getName();
	private static final String PKNAME = "id";

	@Override
	public String getPrimaryKeyName() {
		return PKNAME;
	}

	@Override
	public String getSqlmapNamespace() {
		return SQLMAPNAMESPACE;
	}
	
	@Override
	public double getFundsSum(Map<String, Object> paramMap, boolean b) {
		Object myObject = this.getSqlMap(b).queryForObject(this.getStatement("usersSum"),paramMap);
		if (myObject != null) {
			return Double.parseDouble(myObject.toString());
		}
		return 0.00D;
	}

	@Override
	public Integer getLoginCountOf30(Map<String, Object> paramMap) throws Exception {
		Object myObject = this.getSqlMap(false).queryForObject(this.getStatement("getLoginCountOf30"),paramMap);
		if (myObject != null) {
			return Integer.parseInt(myObject.toString());
		}
		return 0;
	}
}
